<template>
  <div class="home-new">
    <div class="home-new-title">
      <h3>平板专区</h3>
    </div>
    <ul>
      <li v-for="item in newList" :key="item.id">
        <div class="product-card">
          <img :src="item.list_pic_url" alt="" class="product-image">
          <p class="product-name">{{ item.name }}</p>
          <p class="product-price"><span>￥</span>{{ item.retail_price }}</p>
        </div>
      </li>
    </ul>
  </div>
</template>

<script setup>
const newList = [
  { id: 1, name: 'MatePad Air 12英寸', list_pic_url: 'src/assets/HomeNew/1.webp', retail_price: '2899.00' },
  { id: 2, name: 'MatePad 11.5S', list_pic_url: 'src/assets/HomeNew/2.webp', retail_price: '2299.00' },
  { id: 3, name: 'MatePad Pro 11英寸', list_pic_url: 'src/assets/HomeNew/3.webp', retail_price: '4199.00' },
  { id: 4, name: 'MatePad Air', list_pic_url: 'src/assets/HomeNew/5.webp', retail_price: '2299.00' }
]
</script>

<style lang="less" scoped>
.home-new {
  .home-new-title {
    text-align: center;
    font-size: 16px;
    margin-top: 1.6rem;
    height: 50px;
    h3 {
      width: 50%;
      border-top: 2px solid #ccc;
      padding-top: 8px;
      margin: 0 auto;
      font-weight: bold;
      color: #333;
    }
  }

  ul {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    padding: 1rem 0 0;
    background-color: #f9f9f9;

    li {
      width: 49.5%;
      margin-bottom: 10px;
      position: relative;

      .product-card {
        position: relative;
        overflow: hidden;
        border-radius: 10px;
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
        background: #fff;
        transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;

        &:hover {
          transform: scale(1.05);
          box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
          background: linear-gradient(135deg, #ffffff, #f8f8f8);
        }

        .product-image {
          width: 100%;
          border-radius: 10px 10px 0 0;
          display: block;
          transition: transform 0.3s ease;

          &:hover {
            transform: scale(1.1);
          }
        }

        .product-name {
          font-size: 14px;
          color: #333;
          text-align: center;
          margin: 0.5rem 0;
          transition: color 0.3s ease;

          &:hover {
            color: #FF8000;
          }
        }

        .product-price {
          font-size: 16px;
          color: #FF8000;
          text-align: center;
          margin: 0.5rem 0;
          span {
            font-size: 12px;
          }
        }
      }
    }
  }
}
</style>